//C08:Castaway.cpp
// "Casting away" constness
class Y
{
    int i;
    public:
        Y();
        void f() const;
};

Y::Y() { i = 0; }
void Y::f() const
{
    //! i++; // Error -- const member function
    ((Y*)this)->i++; // OK: cast away const-ness
    // Better: use C++ explicit cast syntax:
    (const_cast<Y*>(this))->i++;
}

int main(void)
{
    const Y yy;
    yy.f();   // Actually changes it!
}